home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Io / argv.ntt next >
Encoding:
Text File  |  1996-01-31  |  1.6 KB  |  60 lines

  1. #!./perl
  2.  
  3. # $RCSfile: argv.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:25 $
  4.  
  5. print "1..5\n";
  6.  
  7. open(try, '>Io.argv.tmp') || (die "Can't open temp file.");
  8. print try "a line\n";
  9. close try;
  10.  
  11. #
  12. # Removed the './' qualifier from front of perl command.  GJRL
  13. # Encased 'while (<>)...' in double quotes (was in single quotes) as per
  14. # PERL 4 version.  GJRL 
  15. #
  16. $x = `perl -e "while (<>) {print \$.,\$_;}" Io.argv.tmp Io.argv.tmp`;
  17.  
  18. if ($x eq "1a line\n2a line\n") {print "ok 1\n";} else {print "not ok 1\n";}
  19.  
  20. #
  21. # Removed the './' qualifier from front of perl command.  GJRL
  22. # Encased 'while (<>)...' in double quotes (was in single quotes) as per
  23. # PERL 4 version.  GJRL 
  24. #
  25. $x = `echo foo|perl -e "while (<>) {print $_;}" Io.argv.tmp -`;
  26.  
  27. if ($x eq "a line\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
  28.  
  29. #
  30. # Removed the './' qualifier from front of perl command.  GJRL
  31. # Encased 'while (<>)...' in double quotes (was in single quotes) as per
  32. # PERL 4 version.  GJRL 
  33. #
  34. $x = `echo foo|perl -e "while (<>) {print $_;}"`;
  35.  
  36. if ($x eq "foo\n") {print "ok 3\n";} else {print "not ok 3 :$x:\n";}
  37.  
  38. #
  39. # NTTCLEAN: Modifications have been made to the following line to
  40. #           make it Windows-NT compliant:
  41. #           -> "/dev/null" was translated into "nul"
  42. #
  43. @ARGV = ('Io.argv.tmp', 'Io.argv.tmp', 'nul', 'Io.argv.tmp');
  44. while (<>) {
  45.     $y .= $. . $_;
  46.     if (eof()) {
  47.     if ($. == 3) {print "ok 4\n";} else {print "not ok 4\n";}
  48.     }
  49. }
  50.  
  51. if ($y eq "1a line\n2a line\n3a line\n")
  52.     {print "ok 5\n";}
  53. else
  54.     {print "not ok 5\n";}
  55.  
  56. #
  57. # This command translated into 'del /f/q ...'  GJRL
  58. #`/bin/rm -f Io.argv.tmp`;
  59. unlink Io.argv.tmp;
  60.